package com.xxx.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xxx.common.Code;
import com.xxx.common.Result;

import com.xxx.pojo.ClassInfo;
import com.xxx.service.ClassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/classInfo")
public class ClassInfoController {

    @Autowired
    private ClassInfoService classInfoService;

    @GetMapping("/typesName")
    public Result getTypesList(){
        List<ClassInfo> classInfos = classInfoService.list(new LambdaQueryWrapper<ClassInfo>().orderByAsc(ClassInfo::getOrder));
        return classInfos != null ? new Result(classInfos, Code.GET_OK) : new Result(null,Code.GET_ERR,"后台无数据！！！");
    }

}
